6. 1995년도 4/4분기 동안 점포별 매출액을 구하는 SQL :: 오라클 실습[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

오라클 실습
[1]
등록일:2009-05-28 00:19:56 (0%)
작성자:
제목:6. 1995년도 4/4분기 동안 점포별 매출액을 구하는 SQL
select  a.br_name,  sum(c.sal_amt*c.unit_price)  sa  sum_sale_amt
from  branch  a,  custmer  b,  sale  c
where  a.br_no  =b.br_no
and  b.cust_no=c.cust_no
and  c.saledate  between  ‘19951001’  and  ‘19951231’
group  by  a.br_name;

<개선안1>
select  b.br_name,  sum(v.sum_sale_amt)
from  (select  cust_no,  sum(sale_amt*unit_price)  as  sum_sale_amt
                from  sale
                where  saledate  between  ‘19951001’  and  ‘19951231’
                group  by  a,  branch  b)  v,  customer  a,  branch  b  
where  b.br_no=a.br_no
      and  a.cust_no=v.cust_no
group  by  b.br_name;
[본문링크] 6. 1995년도 4/4분기 동안 점포별 매출액을 구하는 SQL
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=31512
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.